package com.ruoyi.cases.task;

import cn.hutool.core.io.FileUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * @Auther: lihongming
 * @Date: 2023-08-04 9:24
 * @Description: com.ruoyi.cases.task
 * @Version: 1.0
 */
@Slf4j
@Component("delChunksTask")
public class DelChunksTask {

    @Value("${uploadFolder}")
    private String uploadFolder;

    public void delChunksFiles() {
        log.info("###开始删除视频分片数据###");
        Path path = Paths.get(uploadFolder);
        boolean delResult = FileUtil.del(path);
        if (delResult) {
            log.info("###完成删除视频分片数据-成功###");
        } else {
            log.error("###完成删除视频分片数据-失败###");
        }
    }
}
